import { ref } from "vue";
import { defineStore } from "pinia";

import { getHotList } from "../api/index";

export const useHotStore = defineStore("hot", () => {
    const hotBanners = ref([]);
    const uiFunction = ref([]);
    const hotList = ref([]);
    // const res = getHotList();
    async function getHotListData() {
        const res = await getHotList();
        // console.log(res);
        hotBanners.value = res.data.data.children[0].children;
        uiFunction.value = res.data.data.children[1].children;
        hotList.value = res.data.data.children.filter((o,i)=> i>1);
    }
    return { hotBanners,useHotStore,uiFunction, hotList,getHotListData }
})